package everyday;

public class T2432 {
    public int hardestWorker(int n, int[][] logs) {
        int maxTime = logs[0][1];
        int maxId = logs[0][0];
        for (int i = 1; i < logs.length; i++) {
            int time = logs[i][1] - logs[i - 1][1];
            if (time > maxTime) {
                maxTime = time;
                maxId = logs[i][0];
            }
            if (time == maxTime) {
                maxId = Math.min(maxId, logs[i][0]);
            }
        }
        return maxId;
    }
}
